import { Address, toNano } from '@ton/core';
import { LeAIParent } from '../wrappers/TestCact';
import { NetworkProvider } from '@ton/blueprint';

export async function run(provider: NetworkProvider) {

    const testCact = provider.open(await LeAIParent.fromInit(Address.parse('0QAdV3YqhXWMhNgQXuWgibQGo1Y9Dv_v_0gaoP_lDXLcAvxB'),Address.parse('kQBdIUbki6KjQWe6cclpuD5eOPU0ffXMQtLSG1RGOrVfRrpb')));
    //
    // await testCact.send(
    //     provider.sender(),
    //     {
    //         value: toNano('0.05'),
    //     },
    //     {
    //         $$type: 'Deploy',
    //         queryId: 0n,
    //     }
    // );

    // await testCact.send(
    //     provider.sender(),
    //     {
    //         value: toNano('0.08'),
    //     },
    //     null
    // );


    // await testCact.send(
    //     provider.sender(),
    //     {
    //         value: toNano('0.05'),
    //     },
    //     {
    //         $$type: 'AddLeaiBalance',
    //         amount: BigInt(25000000000),
    //         ad: Address.parse('0QAHNPudHJx4-oY7wNc9LgAqhKoI39mYtIJV5f-2Hf5RkyHB')
    //     }
    // );

    //
    await testCact.send(
        provider.sender(),
        {
            value: toNano('0.05'),
        },
        {
            $$type: 'Withdrawal',
            amount: BigInt(25500000000)
        }
    );



    // 每个合约与代币都有一个特殊的钱包地址 提转账 ，如何获取？ 往合约转账一笔可以查看到
    // await testCact.send(
    //     provider.sender(),
    //     {
    //         value: toNano('0.05'),
    //     },
    //     {
    //         $$type: 'JettonAddress',
    //         jettonAddress: Address.parse('kQAdAHv46NpexcLLlQNLOVIgi_lR8z9EN0yoWJ3Ys-3MjFyE'),
    //         walletjettonAddress: Address.parse('kQBOKz0dxDc6WuzV3Ifg_z-8ZwivMuH47ATXoZbdYIyQsp63'),
    //         to: Address.parse('0QAHNPudHJx4-oY7wNc9LgAqhKoI39mYtIJV5f-2Hf5RkyHB')
    //     }
    // );


    await provider.waitForDeploy(testCact.address);

    // console.log('address', await testCact.getGetSend(Address.parse('0QAHNPudHJx4-oY7wNc9LgAqhKoI39mYtIJV5f-2Hf5RkyHB')));
    // console.log('address', await testCact.getGetAmount(Address.parse('0QAHNPudHJx4-oY7wNc9LgAqhKoI39mYtIJV5f-2Hf5RkyHB')));
    // console.log('address1', await testCact.getMyContractAddress(Address.parse('0QAHNPudHJx4-oY7wNc9LgAqhKoI39mYtIJV5f-2Hf5RkyHB')));
    // console.log('address1', await testCact.getMySuperiorAddress(Address.parse('0QAHNPudHJx4-oY7wNc9LgAqhKoI39mYtIJV5f-2Hf5RkyHB')));
    // console.log('address1', await testCact.getMyOwnAddress(Address.parse('0QAHNPudHJx4-oY7wNc9LgAqhKoI39mYtIJV5f-2Hf5RkyHB')));
    // console.log('address1', await testCact.getMyJettonAddress(Address.parse('0QAHNPudHJx4-oY7wNc9LgAqhKoI39mYtIJV5f-2Hf5RkyHB')));
    // console.log('address2', await testCact.getFrom1(Address.parse('0QAHNPudHJx4-oY7wNc9LgAqhKoI39mYtIJV5f-2Hf5RkyHB')));
    console.log('address3', await testCact.getToto(Address.parse('0QAHNPudHJx4-oY7wNc9LgAqhKoI39mYtIJV5f-2Hf5RkyHB')));
    // console.log('address4', await testCact.getFrom2());
}

